struct Person {
    name: String,
    age: u8
}

struct Task {
    title: String,
    assignee: Option<Person>,
}

/*
Option<T> { None, Some(T)}
*/


/// 测试Option泛型
pub fn test() {
    let tasks: [Task; 2] = [
        Task { title: "eating".to_string(), assignee: None},
        Task { title: "walking".to_string(), assignee: Some(Person {
            name: "Julia".to_string(),
            age: 10
        })}
    ];

    for task in tasks.iter() {
        match task {
            Task { title: t, assignee: None } =>
                println!("The task of {} needs someone to take", t),
            Task { title: t, assignee: Some(Person { name: n, age: a})} =>
                println!("Incredible, the task of {} was token by a {} years old girl named {}", t, a, n)
        }
    }
}
